package com.fcat.common.user.service.impl;

import com.fcat.springboot.mybatis.service.impl.TsuantoneBaseServiceImpl;
import com.fcat.common.user.entity.Certificate;
import com.fcat.common.user.mapper.CertificateMapper;
import com.fcat.common.user.service.CertificateService;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

@Service
public class CertificateServiceImpl extends TsuantoneBaseServiceImpl<CertificateMapper, Certificate> implements CertificateService {

    @Override
    public Integer updateByUserId(Certificate certificate) {
        Example example = new Example(Certificate.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo("userId", certificate.getUserId());
        return mapper.updateByExampleSelective(certificate, example);
    }

    @Override
    public Certificate getByUserId(Long userId) {
        Certificate certificate=new Certificate();
        certificate.setUserId(userId);
        return mapper.selectOne(certificate);
    }


}